package com.android.nextBus.Activities;

import com.android.nextBus.JSON.GetBusStopsJSON;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;


public class TestFeaturesActivity extends Activity {
	
	TextView tv;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_features_layout);
		tv = (TextView) findViewById(R.id.textView1);
	}

	
	public void OQCodeOnClick(View v){
		Intent intent = new Intent("com.google.zxing.client.android.SCAN");
		intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
		startActivityForResult(intent, 0);
	}

	
	public void testMapActivityOnclick(View v){
		Intent intent = new Intent(this ,ViewRouteMapActivity.class);
		intent.putExtra(ViewTimesActivity.SHAPE_ID_KEY, "20019");
		startActivity(intent);
	}
	
	
	public void viewStopActivityOnClick(View v){
		Intent intent = new Intent(this, ViewTimesActivity.class);
		// and data to the intent to view the stop with stop_id = 53218
		intent.putExtra(ViewStopsActivity.STOP_ID_KEY, "53218");
		startActivity(intent);
	}
	
	
	public void getDataOnclick(View v){
		Intent intent = new Intent(this ,NextBusAndoridStandaloneActivity.class);
		startActivity(intent);
	}

	
	public void viewRoutesOnClick(View v) {
		Intent intent = new Intent(this, ViewRoutesActivity.class);
		startActivity(intent);
	}
	
	public void testMainMenuOnclick(View v){
		Intent intent = new Intent(this, MainMenuActivity.class);
		startActivity(intent);
	}
	
	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
		String contents = null;
		   if (requestCode == 0) {
		      if (resultCode == RESULT_OK) {
		         contents = intent.getStringExtra("SCAN_RESULT");
		         String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
		         
		         //Intent Intent = new Intent(this,ViewStopActivity.class);
		         //startActivity(intent);
		         
		        // tv.setVisibility(View.VISIBLE);
				 //tv.setText(""+contents + " " + format);
		         // Handle successful scan
		      } else if (resultCode == RESULT_CANCELED) {
		         // Handle cancel

		      }
		      
			//	String busStopDataFeed = GetBusStopsJSON.getBusStops(contents,true);
 
			//	busStopDataFeed = "QR code Contents = " + contents +
					//	"\n"
				//		+ "Raw JSON Data after server Query = " + busStopDataFeed;
				//tv.setVisibility(View.VISIBLE);
				//tv.setText(busStopDataFeed);
		}
	}
	

	@Override
	public void onResume(){
		super.onResume();

		Log.i("msg!!!!", "Resumed");
	}
}
